package com.yidianyanglao.onlinemall.mapper;

import com.yidianyanglao.onlinemall.bean.OnlineBannerBean;
import com.yidianyanglao.onlinemall.bean.OnlineMallBean;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Seed on 2016/12/21.
 */
@Repository
public interface OnlineMallMapper {


    @Select("SELECT * FROM yl_onlinebanner order by sort")
    List<OnlineBannerBean> getBanner();

    @Select("SELECT * FROM yl_online_shop order by sort limit #{pageNum},#{pageSize}")
    List<OnlineMallBean> getShopList(@Param("pageNum")int pageNum,@Param("pageSize")int pageSize);

    @Insert("INSERT INTO yl_online_shop(logo,shopname,adv_desc,acti_info,url,sort,createdate) VALUES (#{logo},#{shopname}," +
            "#{advDesc},#{actiInfo},#{url},#{sort},#{createdate})")
    int addNewShop(OnlineMallBean omb);

    @Insert("INSERT INTO yl_onlinebanner(banner,url,sort,createdate) VALUES (#{banner},#{url},#{sort},#{createdate})")
    int addNewBanner(OnlineBannerBean obb);

    @Update("update yl_onlinebanner set banner=#{banner},url=#{url},sort=#{sort} where uid=#{id}")
    int updateBanner(OnlineBannerBean obb);




}
